﻿/**
 * TimelineManager Event
 * Copyright (c) 2009 Marco Di Giuseppe	| http://designmarco.com
 * marco[at]designmarco[dot]com
 *
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */
package com.designmarco.events
{
	/**
	 * TimelineManagerEvent provides notification of the play state of a MovieClip.
	 * @see com.designmarco.managers.TimelineManager
	 */
	import flash.display.MovieClip;
	import flash.events.Event;

	public class TimelineManagerEvent extends Event
	{
		/**
		 * @eventType onPlay - Dispatched immediately when the clip begins playing.
		 */
		public static const PLAY:String = "play";
		/**
		 * @eventType onStop - Dispatched when the clip stops playing.
		 */
		public static const STOP:String = "stop";
		/**
		 * @eventType onPause - Dispatched when the clip is paused.
		 */
		public static const PAUSE:String = "pause";
		/**
		 *@eventType onCycle - Dispatched each time a loop cycle is completed.
		 */
		public static const CYCLE:String = "cycle";
		/**
		 *@eventType onComplete - Dispatched when the playhead completes the totalCycles
		*/
		public static const COMPLETE:String = "complete";
		
		/**
		 * Target MovieClip of timeline currently being managed.
		 */
		public var clip:MovieClip;
		
		public function TimelineManagerEvent(type:String, clip:MovieClip, bubbles:Boolean = false, cancelable:Boolean = false)
		{
			super(type, bubbles, cancelable);
			this.clip = clip;
		}

		/*** @inheritDoc */
		override public function clone():Event
		{
			return new TimelineManagerEvent(this.type, this.clip, this.bubbles, this.cancelable);
		}

		/*** @inheritDoc */
		override public function toString():String
		{
			return formatToString("TimelineManagerEvent", "type", "clip", "bubbles", "cancelable");
		}
	}
}
